<?php

namespace App\Http\Requests\Api\V1;

class UserRequest extends FormRequest
{
    public function rules()
    {
        return [
            'name'      => 'required|between:3,25|regex:/^[A-Za-z0-9\-\_]+$/|unique:users,name',
            'password'  => 'required|alpha_dash|min:6',
            'phone'     => [
                'required',
                'regex:/^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199)\d{8}$/',
                'unique:users'
            ],
            // 'verification_key' => 'required|string',
            // 'verification_code' => 'required|string',
        ];
    }

    public function attributes()
    {
        return [
            'name'      => '帐号',
            'password'  => '密码',
        ];
    }
}
